﻿requirejs.config({
	paths: {
		'text': '../lib/require/text',
		'durandal': '../lib/durandal/js',
		'plugins': '../lib/durandal/js/plugins',
		'transitions': '../lib/durandal/js/transitions',
		'knockout': '../lib/knockout/knockout-3.4.0',
		'bootstrap': '../lib/bootstrap/js/bootstrap',
		'jquery': '../lib/jquery/jquery-1.9.1',
		'i18next': '../lib/i18next/jquery-i18next'
	},
	shim: {
		'bootstrap': {
			deps: ['jquery'],
			exports: 'jQuery'
		},
		'i18next':{
			deps: ['jquery'],
			exports: 'jQuery'
		}
	}
});

define(['durandal/system', 'durandal/app', 'durandal/viewLocator', 'durandal/binder', 'bootstrap','jquery','i18next',],
	function(system, app, viewLocator, binder, bootstrap,$, i18next) {
		debugger;
		//>>excludeStart("build", true);
		system.debug(true);
		//>>excludeEnd("build");

		var i18NOptions = {
			detectFromHeaders: false,
			debug: true,
			lng: window.navigator.userLanguage || window.navigator.language || 'en-US',
			fallbackLang: 'en',
			ns: 'app',
			resGetPath: 'locales/__lng__/__ns__.json',
			useCookie: false
		};

		app.title = 'Durandal Starter Kit';

		app.configurePlugins({
			router: true,
			dialog: true
		});
		
		app.start().then(function() {
			i18next.init(i18NOptions, function() {
				//Call localization on view before binding...
				binder.binding = function(obj, view) {
					$(view).i18n();
				};

				//Replace 'viewmodels' in the moduleId with 'views' to locate the view.
				//Look for partial views in a 'views' folder in the root.
				viewLocator.useConvention();

				//Show the app by setting the root view model for our application with a transition.
				app.setRoot('viewmodels/shell', 'entrance');
			});
		});
		
	});